#include<iostream>

using namespace std;

class Solution {
public:
	bool isPalindrome(string s) {
		 
		int m = 0;
		for (int n = 0; n < s.size(); n++)
		{
			if ((s[n]>=65&&s[n]<=90)|| (s[n] >= 97 && s[n] <= 122) || (s[n] >= 48 && s[n] <= 57)) m++;
		}
		if (m == 0)return true;
		bool result = true;
		for (int i=0,j=s.size()-1;;i++,j--)
		{
			while (s[i]<48||(s[i] < 65&&s[i]>57)||(s[i]>90 && s[i]<97)||s[i]>122)
			{
				i++;
			}

			while (s[j] < 48 || (s[j] < 65 && s[j]>57) || (s[j] > 90 && s[j] < 97) || s[j]>122)
			{
				j--;
			}
			if (toupper(s[i])!=toupper(s[j])) 
			{
				return false;
			}

			if (i >= j)break;
		}
		return result;
	}
};
//
//int main()
//{
//	Solution *s = new Solution;
//	cout << s->isPalindrome("A man, a plan, a canal: Panama");
//	return 0;
//}